﻿using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace DMSkin.WPF.Controls
{
    public class DMSystemCloseButton : DMSystemButton
    {
        Window targetWindow;
        private System.Windows.Forms.NotifyIcon notifyIcon = null;
        public DMSystemCloseButton()
        {
            DMSystemButtonHoverColor = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));

            Click += delegate
            {
                if (targetWindow == null)
                {
                    targetWindow = Window.GetWindow(this);
                    if (targetWindow.Name == "mainWindow")
                    {
                        //隐藏主窗体
                        targetWindow.Visibility = Visibility.Hidden;
                        return;
                    }
                }
                targetWindow.Close();
            };
        }
    }
}
